#pragma once

#include "../../config.hpp"


namespace dcs {

	struct file_monitor_t {
		struct impl;
		std::unique_ptr<impl> impl_;

		using handler_t = std::function<void(
			const std::filesystem::path&,
			std::uint16_t,
			std::time_t,
			std::time_t,
			const std::vector<float>&,
			const std::uint64_t&
			)
		>;
		file_monitor_t(const log_handler_t&, const std::filesystem::path &, const std::filesystem::path &, const std::string &);
		~file_monitor_t();

		bool start(const handler_t& handler);
		void stop();

		void handle(std::vector<std::uint16_t>, const handler_t&, const std::vector<std::string> &, float, std::uint32_t);
		void update(const std::filesystem::path&, std::time_t);

	private:
		std::filesystem::path find_pdf_handler(const std::filesystem::path&);
		std::uint64_t handle_pdf_handler(const std::filesystem::path&);
	};
}